if ($event.type === 'DETAIL') {

    this.widgetObj.setIconPosition({ right: 420, top: 100 })
    this.widgetObj.setModalPosition({ right: 405, bottom: 20, maxWidth: 1510 })
    const eventData = JSON.parse($event.data)
    const { eventDetails } = eventData
    const detail = this.getApiPage().getApiWidgetsByClassName('detail')
    detail.forEach(v => v.showWidget())
    // 研判
    const $form = this.getApiPage().getApiWidgetByAliasName('judge-content')
    const $img = this.getApiPage().getApiWidgetByAliasName('detail-img')
    console.log('this', this.getApiPage())
    const levels = this.getApiPage().getDataById('744574925553008640')
    const types = this.getApiPage().getDataById('744575296061046784')
    const qualitys = this.getApiPage().getDataById('756194853578080256')

    const formData = {
        ...eventData,
        eventPoint: `${eventData.xCoordinate}, ${eventData.yCoordinate}, ${eventData.zCoordinate}`,
    }
    $form.widgetObj._option.options = {
        eventTypeCode: types.data,
        eventGradeCode: levels.data,
        eventQualityCode: qualitys.data,
        whetherProcess: [
            { name: '未处理', value: 0 },
            { name: '已处理', value: 1 },
            { name: '处理中', value: 2 },
        ],
    }
    //$form.widgetObj.setData(formData)
    $form.widgetObj._option.dataSource = formData;
    $form.widgetObj._option.isDetail = true
    $form.widgetObj.render()
    const form = this.getApiPage().retrievePlugin('base-forms')
    form.resetForm('form_14')
    //form.resetForm('form_15')
    form.resetForm('form_20')
    form.setFormData('form_14', eventData)
    //form.setFormData('form_15', eventData)
    if (eventDetails) {
        const info = JSON.parse(eventDetails)
        console.log('info', info?.thumbnailPath)
        $img.widgetObj.setData([{ data: [{ src: info?.thumbnailPath }] }])
        $img.widgetObj.render()
    }

    var personCountVar = $($form.__box).find("#d-personCount");
    if (personCountVar && personCountVar[0]) {
        personCountVar[0].innerText = "当前参演人员" + (formData.personCount) + "位";
    }
    var drillStateVar = $($form.__box).find("#d-drillState");
    if (drillStateVar && drillStateVar[0]) {
        drillStateVar[0].innerText = formData.drillState;
    }

    // 开始
    const detailStart = this.getApiPage().getApiWidgetByAliasName('detail-start')
    const detailStartIco = this.getApiPage().getApiWidgetByAliasName('detail-start-ico')

    // 解除
    const detailCancel = this.getApiPage().getApiWidgetByAliasName('detail-cancel')
    const detailCancelIco = this.getApiPage().getApiWidgetByAliasName('detail-cancel-ico')

    // 结束
    const detailSuccess = this.getApiPage().getApiWidgetByAliasName('detail-end')
    const detailSuccessIco = this.getApiPage().getApiWidgetByAliasName('detail-end-ico')

    // 进入演练
    const detailEntrance = this.getApiPage().getApiWidgetByAliasName('detail-entrance')
    const detailEntranceIco = this.getApiPage().getApiWidgetByAliasName('detail-entrance-ico')

    /**
     * 0 - 未演练
     * 1 - 已演练
     * 2 - 演练中
     * 3 - 解除演练
     */
    if (eventData.disableFlag === 0) {
        detailStart.showWidget()
        detailStartIco.showWidget()
        detailCancel.showWidget()
        detailCancelIco.showWidget()
        detailSuccess.showWidget()
        detailSuccessIco.showWidget()
        detailEntrance.hideWidget()
        detailEntranceIco.hideWidget()
    } else if (eventData.disableFlag === 1) {
        detailStart.hideWidget()
        detailStartIco.hideWidget()
        detailCancel.hideWidget()
        detailCancelIco.hideWidget()
        detailSuccess.hideWidget()
        detailSuccessIco.hideWidget()
        detailEntrance.hideWidget()
        detailEntranceIco.hideWidget()
    } else if (eventData.disableFlag === 2) {
        detailStart.hideWidget()
        detailStartIco.hideWidget()
        detailCancel.showWidget()
        detailCancelIco.showWidget()
        detailSuccess.showWidget()
        detailSuccessIco.showWidget()
        detailEntrance.showWidget()
        detailEntranceIco.showWidget()
    } else if (eventData.disableFlag === 3) {
        detailStart.hideWidget()
        detailStartIco.hideWidget()
        detailCancel.hideWidget()
        detailCancelIco.hideWidget()
        detailSuccess.showWidget()
        detailSuccessIco.showWidget()
        detailEntrance.hideWidget()
        detailEntranceIco.hideWidget()
    } else {
        detailStart.hideWidget()
        detailStartIco.hideWidget()
        detailCancel.hideWidget()
        detailCancelIco.hideWidget()
        detailSuccess.hideWidget()
        detailSuccessIco.hideWidget()
        detailEntrance.hideWidget()
        detailEntranceIco.hideWidget()
    }
} else if ($event.type === 'sxjhf') {
    const playBack = this.getApiPage().getApiWidgetByAliasName('recorder-player')?.widgetObj;
    // 回放
    if ($event.data?.equipmentConfig && playBack) {
        playBack.addRecorderEquipment({ equipmentConfig: $event.data.equipmentConfig });
    } else {
        window.layer?.msg('未找到录像机配置！');
    }
}

